package org.argeproje.resim.ui.component.math;

import org.argeproje.resim.proc.math.PowerPR;
import org.argeproje.resim.property.DoublePRP;
import org.argeproje.resim.ui.model.ComponentItem;

public class PowerCI extends ComponentItem {

	private static final long serialVersionUID = 1;
	private static final String EXPONENT_PROP = "PowerCI._exponent";
    private double _exponent;
	
	public PowerCI()
	{		
		super();
		_name = "Power";
		_description = "Calculates some power of pixels";
		initProc();
	}
	public void setExponent(double value)
	{
		_exponent = value;
	}
	
	public double getExponent()
	{
		return _exponent;
	}
	protected void initDescriptorList()
	{
		super.initDescriptorList();
		registerProperty(new DoublePRP(this,
		         EXPONENT_PROP,"Exponent","getExponent","setExponent"));
	}

	@Override
	public Class getComponentClass() {
		// TODO Auto-generated method stub
		return PowerCI.class;
	}

	public void initProc() {
		if(_processor == null)
		{
			_processor = new PowerPR();
		}
		_exponent = ((PowerPR)_processor).getParamExponent();
	}
	public void updateProc() {
		if(_processor == null)
		{
			_processor = new PowerPR();
		}
		((PowerPR)_processor).setParameters(_exponent);
	}

}
